package mulis;

import divasoft.client.forms.DebugConsole;
import divasoft.client.forms.rent.*;
import divasoft.client.forms.sale.*;
import divasoft.sync.SyncFrame;
import dvsdk.client.IFrameCore;
import dvsdk.client.MulisFrame;
import dvsdk.client.MulisTable;
import dvsdk.db.Base;
import dvsdk.db.BeanBase;
import dvsdk.db.BeanParam;
import dvsdk.GlobalConfig;
import dvsdk.form.IPhoto;
import dvsdk.form.MouseAdapterDivider;
import dvsdk.form.MulisComponentListenerSize;
import dvsdk.util.ExUtil;
import dvsdk.util.Lang;
import dvsdk.util.Util;
import dvsdk.util.UtilSec;
import dvsdk.util.UtilXML;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Frame;
import java.awt.event.WindowEvent;
import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JToolBar;
import javax.swing.plaf.basic.BasicSplitPaneUI;

/**
 * The application's main frame.
 */
public class MulisView extends FrameView implements IFrameCore, IPhoto  {
    public List<Base> base = new ArrayList<Base>();;
    public boolean base_trash_selected = false;
    public boolean base_favorites_selected = false;
    public boolean init = false;
    private boolean ready = false;
    private List<MulisTable> mulisTables = new ArrayList<MulisTable>();
    public static DebugConsole debugConsole = new DebugConsole();
    private String curFastField="";
    private String addressFilter="";
    private boolean login=false;
    public List<ImageIcon> imgGallery = new ArrayList<ImageIcon>();
    public List<ImageIcon> imgPreGallery = new ArrayList<ImageIcon>();
    public List<ImageIcon> imgOrigGallery = new ArrayList<ImageIcon>();
    private PhotoViewer photoViewer = null;
    public boolean isMaximized = false;
    
    public javax.swing.ActionMap actionMap = null;
    
    final public void initialize() {
        
        this.getFrame().addWindowListener(new WindowListener() {
            @Override
            public void windowOpened(WindowEvent e) { setReady(true); }
            @Override
            public void windowClosing(WindowEvent e) {
                Util.saveHashMap(GlobalConfig.FAVORITE_HASH_FILE, GlobalConfig.selectedRows);
                Util.saveHashMap(GlobalConfig.PFIELDS_HASH_FILE, GlobalConfig.printedRows);
            }
            @Override
            public void windowClosed(WindowEvent e) {}
            @Override
            public void windowIconified(WindowEvent e) {}
            @Override
            public void windowDeiconified(WindowEvent e) {}
            @Override
            public void windowActivated(WindowEvent e) {}
            @Override
            public void windowDeactivated(WindowEvent e) {}
        });
        GlobalConfig.setCore(this);
        actionMap = org.jdesktop.application.Application.getInstance(mulis.MulisApp.class).getContext().getActionMap(MulisView.class, this);
        actionMap.get("company_office").setEnabled(false);
        actionMap.get("company_agent").setEnabled(false);
        //actionMap.get("rec_map").setEnabled(false);
        //actionMap.get("rec_map").
        //actionMap.get("rec_email").setEnabled(false);
        //actionMap.get("rec_www").setEnabled(false);
        // TODO: 10101010101010
        GlobalConfig.GENERATOR=(GlobalConfig.LIST_MODEL.size()<10)?true:false;
        openCurrentTable();
        init=true;
        getFrame().addComponentListener(new MulisComponentListenerSize(780, 480, getFrame()));
        changeFontViewPanel();
        //double wid = jTextArea1.getWidth();
        //double prop = photoSize/(Math.abs(photoSize-jTextArea1.getWidth()));
        //jSplitPane1.setDividerLocation(prop);
        jScrollPane4.getHorizontalScrollBar().setUnitIncrement(GlobalConfig.photoMiniSize+5);
        BasicSplitPaneUI ui = (BasicSplitPaneUI)jSplitPane1.getUI();
        ui.getDivider().addMouseListener(new MouseAdapterDivider(jSplitPane1, jScrollPane2, GlobalConfig.photoMiniSize));
        enableAlpha();
        login();
        toggle_base_favorites.setComponentPopupMenu(jPopupMenu1);
        //GraphicsDevice gd = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        //gd.setFullScreenWindow(this.getFrame());
    }
    
    public MulisView(SingleFrameApplication app) {
        super(app);
        initComponents();
        
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            @Override
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                if ("started".equals(propertyName)) {
                    if (!busyIconTimer.isRunning()) {
                        statusAnimationLabel.setIcon(busyIcons[0]);
                        busyIconIndex = 0;
                        busyIconTimer.start();
                    }
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(true);
                } else if ("done".equals(propertyName)) {
                    busyIconTimer.stop();
                    statusAnimationLabel.setIcon(idleIcon);
                    progressBar.setVisible(false);
                    progressBar.setValue(0);
                } else if ("message".equals(propertyName)) {
                    String text = (String)(evt.getNewValue());
                    statusMessageLabel.setText((text == null) ? "" : text);
                    messageTimer.restart();
                } else if ("progress".equals(propertyName)) {
                    int value = (Integer)(evt.getNewValue());
                    progressBar.setVisible(true);
                    progressBar.setIndeterminate(false);
                    progressBar.setValue(value);
                }
            }
        });
        initialize();
    }
      
    
    public void enableAlpha() {
        //jMenu4.setSize(1, 1);
        //jSplitPane1.setResizeWeight(0.1);
        //toggle_base_agent.setEnabled(false);
        //toggle_base_office.setEnabled(false);
        toggle_base_global.setEnabled(false);
        //jRadioButtonMenuItem1.setEnabled(false);
        //jRadioButtonMenuItem2.setEnabled(false);
        jRadioButtonMenuItem3.setEnabled(false);
        jButton9.setEnabled(false);
        //jButton10.setEnabled(false);
        //jButton11.setEnabled(false);
        
        jButton14.setEnabled(false);
        jButton15.setEnabled(false);
        jComboBox1.setVisible(false);
        //jButton16.setToolTipText("Обновить");
        
        
        jMenuItem11.setEnabled(false);
        jMenuItem12.setEnabled(false);
        //jMenuItem13.setText("Обновить");
        //jMenuItem13.setToolTipText("Обновить (Синхронизация)");
        
        jPanel18.setEnabled(false);
        jMenu3.setVisible(false);
        if (GlobalConfig.DEBUG>0) {
            jMenu3.setVisible(true);
        }
        
        debugConsole.redirectSystem();
    }
    
    private void login() {
        try {
            new LoginFrame(getFrame(), true).setVisible(true);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    
    @Override
    public int openCurrentForm() {
        return this.openCurrentForm(null,null,null);
    }
    
    @Override
    public void editCurrentTable() {
        MulisTable table = getCurrentTable();
        this.openCurrentForm(table.getName(), table.getSqlParams(), table.getCurrentId());
    }
    
    @Override
    public void fakeDeleteCurrentItem() {
        MulisTable table = getCurrentTable();
        List<String> ids = table.getCurrentIds();
        if (ids.isEmpty()) return;
        ExUtil.fake_delete(getBase(table.getName()), table.getName(), ids);
        table.setCurWhere("");
    }
    
    @Override
    public void changeFontOnAllTable() {
        for (Iterator<MulisTable> it = mulisTables.iterator(); it.hasNext();) {
            MulisTable mulisTable = it.next();
            mulisTable.setFont(GlobalConfig.tableFont);
            mulisTable.getTableHeader().setFont(GlobalConfig.tableFont);
        }
    }
    
    @Override
    public void changeFontViewPanel() {
        jTextArea1.setFont(GlobalConfig.viewFont);
        jTextArea1.setForeground(GlobalConfig.fontViewColor);
    }
       
    @Override
    public void openCurrentTable() {
        try {
            if (getCurrentTable()==null) 
                initCurrentTable();
        } catch (Exception ex) {ex.printStackTrace();}
    }
       
    @Override
    public MulisTable getCurrentTable() {
        try {
            int current = this.getCurrentIntFrame();
            if (current==-1) return null;
            for (Iterator<MulisTable> it = mulisTables.iterator(); it.hasNext();) {
                MulisTable mulisTable = it.next();
                if (mulisTable.getType()==current) return mulisTable;
            }
        } catch (Exception ex) {ex.printStackTrace();}
        return null;
    }
    
    @Override
    public void generateListModelCurrentTable() {
        UtilXML.frameToXML(getCurrentForm());
        GlobalConfig.LIST_MODEL.addAll(UtilXML.XMLToCollect(GlobalConfig.LOCATION+"/"+GlobalConfig.XML_DIR));
        UtilXML.XMLToPostCollect(GlobalConfig.USER_HOME_LOCATION+"/"+GlobalConfig.USER_DIR+"/"+GlobalConfig.XML_DIR, GlobalConfig.LIST_MODEL);
    }
    
    @Override
    public void initCurrentTable() {
        try {
            if (GlobalConfig.GENERATOR) {
                generateListModelCurrentTable();
            }
            MulisFrame frame = getCurrentForm();

            Base bs = new Base(frame.getName());
            base.add(bs);
            mulisTables.add(Util.initBaseTable(bs, getCurrentForm(), Util.getCurrentPanel(jTabbedPane2, jTabbedPane3, jTabbedPane4), false));
            
        } catch (Exception ex) {ex.printStackTrace();}
    }
    
    @Override
    public void refreshCurrentTable() {
        refreshCurrentTable(false);
    }
    
    @Override
    public void refreshCurrentTable(boolean force) {
        try {
            MulisTable table = getCurrentTable();
            //table.getRowSort();
            if (getCurrentFilter()==null) return;
            if (force) table.setCurWhere("");
            ExUtil.fillTabelData(getBase(table.getName()), table, table.getName(), table.getSqlVisible(), getCurrentFilter(),false);
        } catch (Exception ex) {ex.printStackTrace();}
    }
    
    @Override
    public void refreshCurrentTableFull() {
        try {
            MulisTable table = getCurrentTable();
            if (getCurrentFilter()==null) return;
            ExUtil.fillTabelData(getBase(table.getName()), table, table.getName(), table.getSqlVisible(), getCurrentFilter(),true);
        } catch (Exception ex) {ex.printStackTrace();}
    }
    
    @Override
    public void refreshCurrentRow() {
        try {
            MulisTable table = getCurrentTable();
            if (table.getCurrentId()==null) {
                refreshCurrentTable(true); 
                return;
            }
            if (getCurrentFilter()==null) return;
            ExUtil.fillTabelData(getBase(table.getName()), table, table.getName(), table.getSqlVisible(), getCurrentFilter(), table.getCurrentId());
            curFastField="";
            fillFastFields(table.getCurrentId(), table.getName());
        } catch (Exception ex) {ex.printStackTrace();}
    }
        
    @Override
    public IFrameCore getCore() {
        return this;
    }

    @Override
    public Base getBase(String name) {
        for (Iterator<Base> it = base.iterator(); it.hasNext();) {
            Base base1 = it.next();
            if (base1.getName().equals(name)) return base1;
            
        }
        return null;
    }
    
    @Override
    public void setFullEnable(boolean en) {
        this.getFrame().setEnabled(en);
    }
    @Override
    public void setDisable() {
        //this.getFrame().setEnabled(false);
        this.getFrame().setVisible(false);
    }
    
    @Override
    public void setEnable() {
        //this.getFrame().setEnabled(true);
        this.getFrame().toFront();
        this.getFrame().setVisible(true);
    }
    
    @Override
    public MulisFrame getCurrentForm() {
        if (GlobalConfig.DEBUG>0) System.out.println("CurrentTab: "+jTabbedPane2.getSelectedIndex());
        MulisFrame ret=null;
        switch ((jTabbedPane2.getSelectedIndex()+1)*10) {
            case Util.F_SALE: ret = this.createCurrentFormSale(); break;
            case Util.F_RENT: ret = this.createCurrentFormRent(); break;
            default: break;
        }
        return ret;
    }
    
    /**
     * Создать форму добавления Продажи/Аренды
     * @return 
     */
    @Override
    public int openCurrentForm(String t_name, String t_param, String id){
        boolean test=Util.notNull(t_name, t_param, id);
        MulisFrame ret=getCurrentForm();
        if (ret!=null) {
            if (test) {
                Util.fillJFrame(ret, ExUtil.fillFromTable(getBase(t_name), t_name, t_param, id)).setVisible(true);
            } else {
                ret.setVisible(true);
            }
        }
        return 0;
    }
    
    /**
     * Создать форму продажи
     */
    @Override
    public MulisFrame createCurrentFormSale() {
        if (GlobalConfig.DEBUG>0) System.out.println("CurrentSale: "+jTabbedPane3.getSelectedIndex());
        MulisFrame ret=null;
        switch (jTabbedPane3.getSelectedIndex()) {
            case Util.F_SALE_KVARTIR: ret = new FSaleKvEditor(getCore()); break;
            case Util.F_SALE_KOMNTAT: ret = new FSaleKoEditor(getCore()); break;
            case Util.F_SALE_KOMMERS: ret = new FSaleKmEditor(getCore()); break;
            case Util.F_SALE_DOM: ret = new FSaleDmEditor(getCore()); break;
            case Util.F_SALE_GARAZG: ret = new FSaleGrEditor(getCore()); break;
            default: break;
        }
        return ret;
    }
   
    /**
     * Создать форму аренды
     */
    @Override
    public MulisFrame createCurrentFormRent() {
        if (GlobalConfig.DEBUG>0) System.out.println("CurrentRent: "+jTabbedPane4.getSelectedIndex());
        MulisFrame ret=null;
        switch (jTabbedPane4.getSelectedIndex()) {
            case Util.F_RENT_KVARTIR: ret = new FRentKvEditor(getCore()); break;
            case Util.F_RENT_KOMNTAT: ret = new FRentKoEditor(getCore()); break;
            case Util.F_RENT_KOMMERS: ret = new FRentKmEditor(getCore()); break;
            case Util.F_RENT_GARAZG: ret = new FRentGrEditor(getCore()); break;
            case Util.F_RENT_DOM: ret = new FRentDmEditor(getCore()); break;
            default: break;
        }
        return ret;
    }
    
    @Override
    public String getCurrentFilter() {
        return Util.getSQLWhere(Util.getCurrentPanel(jTabbedPane2,jTabbedPane3,jTabbedPane4),getSqlStatus()+getSqlAgentFilter()+getSqlAddFilter()+getFavoriteFilter());
    }
    
    @Override
    public boolean checkUpdate(Component cmp) {
        String result = GlobalConfig.checkUpdate();
        boolean ret=(result.isEmpty())?false:true;
        if (ret) if (JOptionPane.showConfirmDialog(cmp, "Перейти на сайт mulis.ru, для загрузки обновления?","Обнаружена новая версия программы!",JOptionPane.OK_CANCEL_OPTION,JOptionPane.INFORMATION_MESSAGE)==JOptionPane.OK_OPTION) {
            Util.openUrlInExternalBorwser("http://mulis.ru");
            System.exit(1);
        }
        return ret;
    }
    
    public String getSqlAgentFilter() {
        if (GlobalConfig.AGENT_INN.isEmpty()) return "";
        return ((toggle_base_agent.isSelected())?" AND idr ='"+GlobalConfig.AGENT_INN+"' ":"")+((toggle_base_office.isSelected())?" AND ida='"+GlobalConfig.MASTER_INN+"' ":"");
    }
    
    public String getFavoriteFilter() {
        if (!toggle_base_favorites.isSelected()) return "";
        return Util.buildFavoriteFilter(getCurrentTable().getName());
    }
    
    public String getSqlAddFilter() {
         return ((jToggleButton14.isSelected())?" AND price >="+((jTextField3.getText().trim().isEmpty())?"0":jTextField3.getText().trim())+
                " AND price <="+((jTextField4.getText().trim().isEmpty())?"99999999":jTextField4.getText().trim()):" ")+
                ((jToggleButton15.isSelected())?" AND s_all >="+((jTextField5.getText().trim().isEmpty())?"0":jTextField5.getText().trim())+
                " AND s_all <="+((jTextField6.getText().trim().isEmpty())?"99999999":jTextField6.getText().trim()):" ")+
                ((jToggleButton16.isSelected() && !addressFilter.isEmpty())?addressFilter:"");
    }
    
    public void buildAddressFilter() {
        if (jTextField7.getText().trim().isEmpty()) {addressFilter=""; return;}
        
        String tmp_loc=Lang.findByName("loc", jTextField7.getText().trim(), false);
        String tmp_street=Lang.findByName("street", jTextField7.getText().trim(), false);
        String tmp_num[]=jTextField7.getText().trim().split(" ");
        String tmp_flt="";
        addressFilter=" AND ("
                + filterAdd(tmp_flt, " loc IN ("+tmp_loc+") ", jComboBox1.getSelectedItem().toString())
                //+ ((!tmp_loc.isEmpty())?" loc IN ("+tmp_loc+") ":"")
                //+ ((!tmp_street.isEmpty())?(jComboBox1.getSelectedItem().toString())+" street IN ("+tmp_street+") ":"")
                + ((!tmp_street.trim().isEmpty()) ? filterAdd(tmp_street, " street IN ("+tmp_street+") ", jComboBox1.getSelectedItem().toString()) : " ")
                + ((tmp_num.length>1)?(jComboBox1.getSelectedItem().toString())+" nhome LIKE '%"+tmp_num[tmp_num.length-1]+"%' ":"")
                //+ filterAdd(tmp_street, " street IN ("+tmp_street+") ", jComboBox1.getSelectedItem().toString())
                + " OR loctab LIKE '%"+jTextField7.getText().trim()+"%') ";
    }
    
    public String filterAdd(String adr, String str, String how) {
        //String ret=adr;
        adr=(adr.isEmpty())?"":(!str.isEmpty())?how:"";
        adr+=(!str.isEmpty())?str:"";
        return adr;
    }
    
    @Override
    public String getSqlStatus() {
        return "state="+((base_trash_selected)?"0":"1");
    }
    
    @Override
    public void fillFastFields(String id, String base_name) {
        if (id==null) return;
        if ((id+base_name).equals(curFastField)) return;
        curFastField=id+base_name;
        List<BeanBase> binBases = ExUtil.selectSE(getBase(base_name), base_name, "area,city,street,nhome,comment,photos", "id="+id);
        for (Iterator<BeanBase> it = binBases.iterator(); it.hasNext();) {
            BeanBase binBase = it.next();
            List<BeanParam> binParams = binBase.getParams();
            String address = "";
            jTextField2.setText(Lang.findAgentContactByIDA(binBase.getIda(), binBase.getIdr()));
            for (BeanParam binParam : binParams) {
                if (binParam.getName().equals("area")) { address+=Lang.findByName(binParam.getName(), binParam.getValue()) +", "; }
                else if (binParam.getName().equals("city")) { address+=Lang.findByName(binParam.getName(), binParam.getValue())+", "; }
                else if (binParam.getName().equals("street")) { address+=Lang.findByName(binParam.getName(), binParam.getValue())+", "; }
                else if (binParam.getName().equals("nhome")) { address+=binParam.getValue(); }
                else if (binParam.getName().equals("comment")) { jTextArea1.setText(binParam.getValue()); }
                else if (binParam.getName().equals("photos")) { if (!binParam.getValue().isEmpty()) {
                        mainPhotoPanel.removeAll(); mainPhotoPanel.repaint();
                        List<File> imgs=Util.loadImagesFromDir(id, binBase.getIda(), base_name);
                        imgOrigGallery=Util.generateGalleryImages(GlobalConfig.photoMiniSize, imgs, imgPreGallery);
                        Util.fillMiniPhotoGallery(mainPhotoPanel, GlobalConfig.photoMiniSize, imgPreGallery, this);
                    } else {
                        mainPhotoPanel.removeAll(); mainPhotoPanel.setSize(GlobalConfig.photoMiniSize, GlobalConfig.photoMiniSize); mainPhotoPanel.repaint();
                    }
                }
            }
            jTextField1.setText(address);
        }
    }
    
    @Override
    public boolean isReady() {
        return ready;
    }
    
    public void setReady(boolean state) {
        if (GlobalConfig.DEBUG>0) System.out.println("Ready: "+state);
        this.ready=state;
    }
    
    @Override
    public void printSelected() {
        MulisTable table = getCurrentTable();
        List<String> ids = table.getCurrentIds();
        PrintDialog pd = new PrintDialog(getFrame(), true, (ids.isEmpty())?true:false, table.getName(), table.getSqlVisible());
        if (pd.execute()) {
            // Все доступные параметры public
            if (pd.allRadio.isSelected()) ids.clear();
            ExUtil.buildPrintTMPL(getBase(table.getName()), table.getName(), table.getSqlVisible()+",comment,comment_private,loctab", (ids.isEmpty())?getCurrentFilter():"", ids, pd.shablonCombo.getSelectedIndex(), pd.mapCheck.isSelected(), pd.addonCheck.isSelected(), pd.photoCheck.isSelected(), pd.contactCheck.isSelected()); //"area,city,street,nhome,comment,a_phone"
        }
    }
    
    @Override
    public void setCurrentTab(int i, int j) {
        switch ((i+1)*10) {
            case Util.F_SALE: jTabbedPane2.setSelectedIndex(i); jTabbedPane3.setSelectedIndex(j); break;
            case Util.F_RENT: jTabbedPane2.setSelectedIndex(i); jTabbedPane4.setSelectedIndex(j); break;
            default: break;
        }
        if (init) openCurrentTable();
    }
    
    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        jButton1 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        toggle_base_agent = new javax.swing.JToggleButton();
        toggle_base_office = new javax.swing.JToggleButton();
        toggle_base_global = new javax.swing.JToggleButton();
        jSeparator11 = new javax.swing.JToolBar.Separator();
        toggle_base_favorites = new javax.swing.JToggleButton();
        jToggleButton6 = new javax.swing.JToggleButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        jButton9 = new javax.swing.JButton();
        jButton10 = new javax.swing.JButton();
        jButton11 = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        jButton18 = new javax.swing.JButton();
        jButton13 = new javax.swing.JButton();
        jSeparator16 = new javax.swing.JToolBar.Separator();
        jButton14 = new javax.swing.JButton();
        jButton15 = new javax.swing.JButton();
        jButton16 = new javax.swing.JButton();
        jSeparator9 = new javax.swing.JToolBar.Separator();
        jButton17 = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jTabbedPane2 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jTabbedPane3 = new javax.swing.JTabbedPane();
        jPanel4 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        jToggleButton1 = new javax.swing.JToggleButton();
        jToggleButton2 = new javax.swing.JToggleButton();
        jToggleButton3 = new javax.swing.JToggleButton();
        jToggleButton4 = new javax.swing.JToggleButton();
        jToggleButton5 = new javax.swing.JToggleButton();
        jToggleButton7 = new javax.swing.JToggleButton();
        jPanel5 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jPanel3 = new javax.swing.JPanel();
        jTabbedPane4 = new javax.swing.JTabbedPane();
        jPanel11 = new javax.swing.JPanel();
        jPanel20 = new javax.swing.JPanel();
        jToggleButton8 = new javax.swing.JToggleButton();
        jToggleButton9 = new javax.swing.JToggleButton();
        jToggleButton10 = new javax.swing.JToggleButton();
        jToggleButton11 = new javax.swing.JToggleButton();
        jToggleButton12 = new javax.swing.JToggleButton();
        jToggleButton13 = new javax.swing.JToggleButton();
        jPanel13 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        jPanel15 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jToolBar2 = new javax.swing.JToolBar();
        jPanel6 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jSplitPane1 = new javax.swing.JSplitPane();
        jScrollPane4 = new javax.swing.JScrollPane();
        mainPhotoPanel = new javax.swing.JPanel();
        btnAdd = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTextArea1 = new javax.swing.JTextArea();
        jPanel18 = new javax.swing.JPanel();
        panelFlowAddressPhone = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jTextField2 = new javax.swing.JTextField();
        panelFlowAddressMap = new javax.swing.JPanel();
        jTextField1 = new javax.swing.JTextField();
        jButton2 = new javax.swing.JButton();
        panelFlowFilterAddress = new javax.swing.JPanel();
        jToggleButton16 = new javax.swing.JToggleButton();
        jComboBox1 = new javax.swing.JComboBox();
        jTextField7 = new javax.swing.JTextField();
        panelFlowFilterPrice = new javax.swing.JPanel();
        jTextField4 = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jToggleButton14 = new javax.swing.JToggleButton();
        jLabel7 = new javax.swing.JLabel();
        jTextField6 = new javax.swing.JTextField();
        jTextField3 = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        jSeparator13 = new javax.swing.JSeparator();
        jToggleButton15 = new javax.swing.JToggleButton();
        jLabel8 = new javax.swing.JLabel();
        jTextField5 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jMenuItem2 = new javax.swing.JMenuItem();
        jMenuItem3 = new javax.swing.JMenuItem();
        jSeparator2 = new javax.swing.JPopupMenu.Separator();
        jMenuItem22 = new javax.swing.JMenuItem();
        jMenuItem4 = new javax.swing.JMenuItem();
        jMenuItem5 = new javax.swing.JMenuItem();
        jMenuItem6 = new javax.swing.JMenuItem();
        jSeparator10 = new javax.swing.JPopupMenu.Separator();
        jMenuItem14 = new javax.swing.JMenuItem();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        jMenu1 = new javax.swing.JMenu();
        jRadioButtonMenuItem1 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem2 = new javax.swing.JRadioButtonMenuItem();
        jRadioButtonMenuItem3 = new javax.swing.JRadioButtonMenuItem();
        jSeparator12 = new javax.swing.JPopupMenu.Separator();
        jCheckBoxMenuItem1 = new javax.swing.JCheckBoxMenuItem();
        jCheckBoxMenuItem4 = new javax.swing.JCheckBoxMenuItem();
        jSeparator6 = new javax.swing.JPopupMenu.Separator();
        jMenuItem7 = new javax.swing.JMenuItem();
        jMenuItem8 = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        jMenuItem10 = new javax.swing.JMenuItem();
        jSeparator7 = new javax.swing.JPopupMenu.Separator();
        jMenuItem11 = new javax.swing.JMenuItem();
        jMenuItem12 = new javax.swing.JMenuItem();
        jSeparator8 = new javax.swing.JPopupMenu.Separator();
        jMenuItem13 = new javax.swing.JMenuItem();
        jMenuItem17 = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        jMenuItem16 = new javax.swing.JMenuItem();
        jMenuItem23 = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        jMenuItem9 = new javax.swing.JMenuItem();
        jMenuItem15 = new javax.swing.JMenuItem();
        jMenuItem24 = new javax.swing.JMenuItem();
        jSeparator15 = new javax.swing.JPopupMenu.Separator();
        debugButton = new javax.swing.JMenuItem();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        jCheckBoxMenuItem3 = new javax.swing.JCheckBoxMenuItem();
        jCheckBoxMenuItem2 = new javax.swing.JCheckBoxMenuItem();
        jMenuItem18 = new javax.swing.JMenuItem();
        jMenuItem19 = new javax.swing.JMenuItem();
        jMenuItem20 = new javax.swing.JMenuItem();
        jMenuItem21 = new javax.swing.JMenuItem();
        jRadioButtonMenuItem5 = new javax.swing.JRadioButtonMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        buttonGroup3 = new javax.swing.ButtonGroup();
        jPopupMenu1 = new javax.swing.JPopupMenu();
        jMenuClearFavorites = new javax.swing.JMenuItem();

        mainPanel.setMinimumSize(new java.awt.Dimension(722, 400));
        mainPanel.setName("mainPanel"); // NOI18N
        mainPanel.setLayout(new java.awt.BorderLayout());

        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(mulis.MulisApp.class).getContext().getActionMap(MulisView.class, this);
        jButton1.setAction(actionMap.get("rec_new")); // NOI18N
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(mulis.MulisApp.class).getContext().getResourceMap(MulisView.class);
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setName("jButton1"); // NOI18N
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton1);

        jButton3.setAction(actionMap.get("rec_edit")); // NOI18N
        jButton3.setText(resourceMap.getString("jButton3.text")); // NOI18N
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton3.setName("jButton3"); // NOI18N
        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton3);

        jButton4.setAction(actionMap.get("rec_del")); // NOI18N
        jButton4.setText(resourceMap.getString("jButton4.text")); // NOI18N
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setName("jButton4"); // NOI18N
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton4);

        jSeparator1.setName("jSeparator1"); // NOI18N
        jToolBar1.add(jSeparator1);

        toggle_base_agent.setAction(actionMap.get("base_agent")); // NOI18N
        buttonGroup1.add(toggle_base_agent);
        toggle_base_agent.setSelected(true);
        toggle_base_agent.setText(resourceMap.getString("toggle_base_agent.text")); // NOI18N
        toggle_base_agent.setFocusable(false);
        toggle_base_agent.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        toggle_base_agent.setName("toggle_base_agent"); // NOI18N
        toggle_base_agent.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(toggle_base_agent);

        toggle_base_office.setAction(actionMap.get("base_office")); // NOI18N
        buttonGroup1.add(toggle_base_office);
        toggle_base_office.setText(resourceMap.getString("toggle_base_office.text")); // NOI18N
        toggle_base_office.setFocusable(false);
        toggle_base_office.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        toggle_base_office.setName("toggle_base_office"); // NOI18N
        toggle_base_office.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(toggle_base_office);

        toggle_base_global.setAction(actionMap.get("base_global")); // NOI18N
        buttonGroup1.add(toggle_base_global);
        toggle_base_global.setText(resourceMap.getString("toggle_base_global.text")); // NOI18N
        toggle_base_global.setToolTipText(resourceMap.getString("toggle_base_global.toolTipText")); // NOI18N
        toggle_base_global.setFocusable(false);
        toggle_base_global.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        toggle_base_global.setName("toggle_base_global"); // NOI18N
        toggle_base_global.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(toggle_base_global);

        jSeparator11.setName("jSeparator11"); // NOI18N
        jToolBar1.add(jSeparator11);

        toggle_base_favorites.setAction(actionMap.get("only_favorites")); // NOI18N
        toggle_base_favorites.setText(resourceMap.getString("toggle_base_favorites.text")); // NOI18N
        toggle_base_favorites.setFocusable(false);
        toggle_base_favorites.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        toggle_base_favorites.setName("toggle_base_favorites"); // NOI18N
        toggle_base_favorites.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(toggle_base_favorites);

        jToggleButton6.setAction(actionMap.get("base_trash")); // NOI18N
        jToggleButton6.setText(resourceMap.getString("jToggleButton6.text")); // NOI18N
        jToggleButton6.setFocusable(false);
        jToggleButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jToggleButton6.setName("jToggleButton6"); // NOI18N
        jToggleButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jToggleButton6);

        jSeparator3.setName("jSeparator3"); // NOI18N
        jToolBar1.add(jSeparator3);

        jButton7.setAction(actionMap.get("company_office")); // NOI18N
        jButton7.setText(resourceMap.getString("jButton7.text")); // NOI18N
        jButton7.setFocusable(false);
        jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton7.setName("jButton7"); // NOI18N
        jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton7);

        jButton8.setAction(actionMap.get("company_agent")); // NOI18N
        jButton8.setText(resourceMap.getString("jButton8.text")); // NOI18N
        jButton8.setFocusable(false);
        jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton8.setName("jButton8"); // NOI18N
        jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton8);

        jSeparator4.setName("jSeparator4"); // NOI18N
        jToolBar1.add(jSeparator4);

        jButton9.setAction(actionMap.get("rec_map")); // NOI18N
        jButton9.setText(resourceMap.getString("jButton9.text")); // NOI18N
        jButton9.setFocusable(false);
        jButton9.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton9.setName("jButton9"); // NOI18N
        jButton9.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton9);

        jButton10.setAction(actionMap.get("rec_email")); // NOI18N
        jButton10.setText(resourceMap.getString("jButton10.text")); // NOI18N
        jButton10.setFocusable(false);
        jButton10.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton10.setName("jButton10"); // NOI18N
        jButton10.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton10);

        jButton11.setAction(actionMap.get("rec_www")); // NOI18N
        jButton11.setText(resourceMap.getString("jButton11.text")); // NOI18N
        jButton11.setFocusable(false);
        jButton11.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton11.setName("jButton11"); // NOI18N
        jButton11.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton11);

        jSeparator5.setName("jSeparator5"); // NOI18N
        jToolBar1.add(jSeparator5);

        jButton18.setAction(actionMap.get("table_refresh")); // NOI18N
        jButton18.setText(resourceMap.getString("jButton18.text")); // NOI18N
        jButton18.setFocusable(false);
        jButton18.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton18.setName("jButton18"); // NOI18N
        jButton18.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton18);

        jButton13.setAction(actionMap.get("recs_print")); // NOI18N
        jButton13.setText(resourceMap.getString("jButton13.text")); // NOI18N
        jButton13.setFocusable(false);
        jButton13.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton13.setName("jButton13"); // NOI18N
        jButton13.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton13);

        jSeparator16.setName("jSeparator16"); // NOI18N
        jToolBar1.add(jSeparator16);

        jButton14.setAction(actionMap.get("recs_export")); // NOI18N
        jButton14.setText(resourceMap.getString("jButton14.text")); // NOI18N
        jButton14.setFocusable(false);
        jButton14.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton14.setName("jButton14"); // NOI18N
        jButton14.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton14);

        jButton15.setAction(actionMap.get("recs_import")); // NOI18N
        jButton15.setText(resourceMap.getString("jButton15.text")); // NOI18N
        jButton15.setFocusable(false);
        jButton15.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton15.setName("jButton15"); // NOI18N
        jButton15.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton15);

        jButton16.setAction(actionMap.get("recs_sync")); // NOI18N
        jButton16.setText(resourceMap.getString("jButton16.text")); // NOI18N
        jButton16.setFocusable(false);
        jButton16.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton16.setName("jButton16"); // NOI18N
        jButton16.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton16);

        jSeparator9.setName("jSeparator9"); // NOI18N
        jToolBar1.add(jSeparator9);

        jButton17.setAction(actionMap.get("pro_config")); // NOI18N
        jButton17.setText(resourceMap.getString("jButton17.text")); // NOI18N
        jButton17.setFocusable(false);
        jButton17.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton17.setName("jButton17"); // NOI18N
        jButton17.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(jButton17);

        mainPanel.add(jToolBar1, java.awt.BorderLayout.NORTH);

        jPanel1.setName("jPanel1"); // NOI18N
        jPanel1.setLayout(new javax.swing.BoxLayout(jPanel1, javax.swing.BoxLayout.LINE_AXIS));

        jTabbedPane2.setName("jTabbedPane2"); // NOI18N
        jTabbedPane2.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane2StateChanged(evt);
            }
        });

        jPanel2.setName("jPanel2"); // NOI18N
        jPanel2.setLayout(new java.awt.BorderLayout());

        jTabbedPane3.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        jTabbedPane3.setName("jTabbedPane3"); // NOI18N
        jTabbedPane3.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane3StateChanged(evt);
            }
        });

        jPanel4.setName("jPanel4"); // NOI18N
        jPanel4.setLayout(new java.awt.BorderLayout());

        jPanel19.setName("jPanel19"); // NOI18N
        jPanel19.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        jToggleButton1.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup2.add(jToggleButton1);
        jToggleButton1.setText(resourceMap.getString("jToggleButton1.text")); // NOI18N
        jToggleButton1.setName("jToggleButton1"); // NOI18N
        jPanel19.add(jToggleButton1);
        jToggleButton1.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton1.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton2.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup2.add(jToggleButton2);
        jToggleButton2.setText(resourceMap.getString("jToggleButton2.text")); // NOI18N
        jToggleButton2.setName("jToggleButton2"); // NOI18N
        jPanel19.add(jToggleButton2);
        jToggleButton2.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton2.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton3.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup2.add(jToggleButton3);
        jToggleButton3.setText(resourceMap.getString("jToggleButton3.text")); // NOI18N
        jToggleButton3.setName("jToggleButton3"); // NOI18N
        jPanel19.add(jToggleButton3);
        jToggleButton3.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton3.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton4.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup2.add(jToggleButton4);
        jToggleButton4.setText(resourceMap.getString("jToggleButton4.text")); // NOI18N
        jToggleButton4.setName("jToggleButton4"); // NOI18N
        jPanel19.add(jToggleButton4);
        jToggleButton4.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton4.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton5.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup2.add(jToggleButton5);
        jToggleButton5.setSelected(true);
        jToggleButton5.setText(resourceMap.getString("jToggleButton5.text")); // NOI18N
        jToggleButton5.setName("jToggleButton5"); // NOI18N
        jPanel19.add(jToggleButton5);
        jToggleButton5.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton5.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton7.setAction(actionMap.get("recs_refresh")); // NOI18N
        jToggleButton7.setText(resourceMap.getString("jToggleButton7.text")); // NOI18N
        jToggleButton7.setName("jToggleButton7"); // NOI18N
        jPanel19.add(jToggleButton7);
        jToggleButton7.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton7.AccessibleContext.accessibleDescription")); // NOI18N

        jPanel4.add(jPanel19, java.awt.BorderLayout.SOUTH);

        jTabbedPane3.addTab(resourceMap.getString("jPanel4.TabConstraints.tabTitle"), jPanel4); // NOI18N

        jPanel5.setName("jPanel5"); // NOI18N
        jPanel5.setLayout(new java.awt.BorderLayout());
        jTabbedPane3.addTab(resourceMap.getString("jPanel5.TabConstraints.tabTitle"), jPanel5); // NOI18N

        jPanel7.setName("jPanel7"); // NOI18N
        jPanel7.setLayout(new java.awt.BorderLayout());
        jTabbedPane3.addTab(resourceMap.getString("jPanel7.TabConstraints.tabTitle"), jPanel7); // NOI18N

        jPanel8.setEnabled(false);
        jPanel8.setName("jPanel8"); // NOI18N
        jPanel8.setLayout(new java.awt.BorderLayout());
        jTabbedPane3.addTab(resourceMap.getString("jPanel8.TabConstraints.tabTitle"), jPanel8); // NOI18N

        jPanel9.setEnabled(false);
        jPanel9.setName("jPanel9"); // NOI18N
        jPanel9.setLayout(new java.awt.BorderLayout());
        jTabbedPane3.addTab(resourceMap.getString("jPanel9.TabConstraints.tabTitle"), jPanel9); // NOI18N

        jPanel2.add(jTabbedPane3, java.awt.BorderLayout.CENTER);

        jTabbedPane2.addTab(resourceMap.getString("jPanel2.TabConstraints.tabTitle"), jPanel2); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N
        jPanel3.setLayout(new java.awt.BorderLayout());

        jTabbedPane4.setTabPlacement(javax.swing.JTabbedPane.BOTTOM);
        jTabbedPane4.setName("jTabbedPane4"); // NOI18N
        jTabbedPane4.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jTabbedPane4StateChanged(evt);
            }
        });

        jPanel11.setName("jPanel11"); // NOI18N
        jPanel11.setLayout(new java.awt.BorderLayout());

        jPanel20.setName("jPanel20"); // NOI18N
        jPanel20.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        jToggleButton8.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup3.add(jToggleButton8);
        jToggleButton8.setText(resourceMap.getString("jToggleButton8.text")); // NOI18N
        jToggleButton8.setName("jToggleButton8"); // NOI18N
        jPanel20.add(jToggleButton8);
        jToggleButton8.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton8.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton9.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup3.add(jToggleButton9);
        jToggleButton9.setText(resourceMap.getString("jToggleButton9.text")); // NOI18N
        jToggleButton9.setName("jToggleButton9"); // NOI18N
        jPanel20.add(jToggleButton9);
        jToggleButton9.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton9.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton10.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup3.add(jToggleButton10);
        jToggleButton10.setText(resourceMap.getString("jToggleButton10.text")); // NOI18N
        jToggleButton10.setName("jToggleButton10"); // NOI18N
        jPanel20.add(jToggleButton10);
        jToggleButton10.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton10.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton11.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup3.add(jToggleButton11);
        jToggleButton11.setText(resourceMap.getString("jToggleButton11.text")); // NOI18N
        jToggleButton11.setName("jToggleButton11"); // NOI18N
        jPanel20.add(jToggleButton11);
        jToggleButton11.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton11.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton12.setAction(actionMap.get("recs_refresh")); // NOI18N
        buttonGroup3.add(jToggleButton12);
        jToggleButton12.setSelected(true);
        jToggleButton12.setText(resourceMap.getString("jToggleButton12.text")); // NOI18N
        jToggleButton12.setName("jToggleButton12"); // NOI18N
        jPanel20.add(jToggleButton12);
        jToggleButton12.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton12.AccessibleContext.accessibleDescription")); // NOI18N

        jToggleButton13.setAction(actionMap.get("recs_refresh")); // NOI18N
        jToggleButton13.setText(resourceMap.getString("jToggleButton13.text")); // NOI18N
        jToggleButton13.setName("jToggleButton13"); // NOI18N
        jPanel20.add(jToggleButton13);
        jToggleButton13.getAccessibleContext().setAccessibleDescription(resourceMap.getString("jToggleButton13.AccessibleContext.accessibleDescription")); // NOI18N

        jPanel11.add(jPanel20, java.awt.BorderLayout.SOUTH);

        jTabbedPane4.addTab(resourceMap.getString("jPanel11.TabConstraints.tabTitle"), jPanel11); // NOI18N

        jPanel13.setName("jPanel13"); // NOI18N
        jPanel13.setLayout(new java.awt.BorderLayout());
        jTabbedPane4.addTab(resourceMap.getString("jPanel13.TabConstraints.tabTitle"), jPanel13); // NOI18N

        jPanel14.setName("jPanel14"); // NOI18N
        jPanel14.setLayout(new java.awt.BorderLayout());
        jTabbedPane4.addTab(resourceMap.getString("jPanel14.TabConstraints.tabTitle"), jPanel14); // NOI18N

        jPanel15.setName("jPanel15"); // NOI18N
        jPanel15.setLayout(new java.awt.BorderLayout());
        jTabbedPane4.addTab(resourceMap.getString("jPanel15.TabConstraints.tabTitle"), jPanel15); // NOI18N

        jPanel10.setName("jPanel10"); // NOI18N
        jPanel10.setLayout(new java.awt.BorderLayout());
        jTabbedPane4.addTab(resourceMap.getString("jPanel10.TabConstraints.tabTitle"), jPanel10); // NOI18N

        jPanel3.add(jTabbedPane4, java.awt.BorderLayout.CENTER);

        jTabbedPane2.addTab(resourceMap.getString("jPanel3.TabConstraints.tabTitle"), jPanel3); // NOI18N

        jPanel1.add(jTabbedPane2);

        mainPanel.add(jPanel1, java.awt.BorderLayout.CENTER);

        jToolBar2.setRollover(true);
        jToolBar2.setName("jToolBar2Name"); // NOI18N

        jPanel6.setName("jPanel6"); // NOI18N

        jPanel17.setName("jPanel17"); // NOI18N
        jPanel17.setLayout(new java.awt.BorderLayout());

        jSplitPane1.setName("jSplitPane1"); // NOI18N

        jScrollPane4.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        jScrollPane4.setAutoscrolls(true);
        jScrollPane4.setDoubleBuffered(true);
        jScrollPane4.setMinimumSize(new java.awt.Dimension(112, 112));
        jScrollPane4.setName("jScrollPane4"); // NOI18N
        jScrollPane4.setPreferredSize(new java.awt.Dimension(112, 112));

        mainPhotoPanel.setName("mainPhotoPanel"); // NOI18N
        mainPhotoPanel.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEADING));

        btnAdd.setIcon(new javax.swing.ImageIcon(getClass().getResource("/mulis/resources/1x1.png"))); // NOI18N
        btnAdd.setToolTipText(resourceMap.getString("btnAdd.toolTipText")); // NOI18N
        btnAdd.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        btnAdd.setContentAreaFilled(false);
        btnAdd.setMargin(new java.awt.Insets(0, 0, 0, 0));
        btnAdd.setMaximumSize(new java.awt.Dimension(100, 100));
        btnAdd.setMinimumSize(new java.awt.Dimension(100, 100));
        btnAdd.setName("btnAdd"); // NOI18N
        btnAdd.setPreferredSize(new java.awt.Dimension(100, 100));
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });
        mainPhotoPanel.add(btnAdd);

        jScrollPane4.setViewportView(mainPhotoPanel);

        jSplitPane1.setLeftComponent(jScrollPane4);

        jScrollPane2.setBorder(javax.swing.BorderFactory.createTitledBorder(resourceMap.getString("jScrollPane2.border.title"))); // NOI18N
        jScrollPane2.setName("jScrollPane2"); // NOI18N

        jTextArea1.setColumns(20);
        jTextArea1.setEditable(false);
        jTextArea1.setRows(5);
        jTextArea1.setName("jTextArea1"); // NOI18N
        jScrollPane2.setViewportView(jTextArea1);

        jSplitPane1.setRightComponent(jScrollPane2);

        jPanel17.add(jSplitPane1, java.awt.BorderLayout.CENTER);

        jPanel18.setMaximumSize(new java.awt.Dimension(32767, 118));
        jPanel18.setMinimumSize(new java.awt.Dimension(475, 118));
        jPanel18.setName("jPanel18"); // NOI18N
        jPanel18.setPreferredSize(new java.awt.Dimension(450, 88));
        jPanel18.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));

        panelFlowAddressPhone.setMinimumSize(new java.awt.Dimension(450, 23));
        panelFlowAddressPhone.setName("panelFlowAddressPhone"); // NOI18N
        panelFlowAddressPhone.setPreferredSize(new java.awt.Dimension(462, 23));

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        jTextField2.setEditable(false);
        jTextField2.setName("jTextField2"); // NOI18N

        javax.swing.GroupLayout panelFlowAddressPhoneLayout = new javax.swing.GroupLayout(panelFlowAddressPhone);
        panelFlowAddressPhone.setLayout(panelFlowAddressPhoneLayout);
        panelFlowAddressPhoneLayout.setHorizontalGroup(
            panelFlowAddressPhoneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowAddressPhoneLayout.createSequentialGroup()
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE))
        );
        panelFlowAddressPhoneLayout.setVerticalGroup(
            panelFlowAddressPhoneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
            .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE)
        );

        jPanel18.add(panelFlowAddressPhone);

        panelFlowAddressMap.setMinimumSize(new java.awt.Dimension(462, 23));
        panelFlowAddressMap.setName("panelFlowAddressMap"); // NOI18N
        panelFlowAddressMap.setPreferredSize(new java.awt.Dimension(462, 23));

        jTextField1.setEditable(false);
        jTextField1.setName("jTextField1"); // NOI18N

        jButton2.setText("Найти на карте...");
        jButton2.setName("jButton2"); // NOI18N
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelFlowAddressMapLayout = new javax.swing.GroupLayout(panelFlowAddressMap);
        panelFlowAddressMap.setLayout(panelFlowAddressMapLayout);
        panelFlowAddressMapLayout.setHorizontalGroup(
            panelFlowAddressMapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowAddressMapLayout.createSequentialGroup()
                .addComponent(jButton2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))
        );
        panelFlowAddressMapLayout.setVerticalGroup(
            panelFlowAddressMapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowAddressMapLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jButton2)
                .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel18.add(panelFlowAddressMap);

        panelFlowFilterAddress.setMinimumSize(new java.awt.Dimension(462, 23));
        panelFlowFilterAddress.setName("panelFlowFilterAddress"); // NOI18N
        panelFlowFilterAddress.setPreferredSize(new java.awt.Dimension(462, 23));

        jToggleButton16.setAction(actionMap.get("recs_refresh")); // NOI18N
        jToggleButton16.setText(resourceMap.getString("jToggleButton16.text")); // NOI18N
        jToggleButton16.setName("jToggleButton16"); // NOI18N
        jToggleButton16.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jToggleButton16ActionPerformed(evt);
            }
        });

        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "OR", "AND" }));
        jComboBox1.setToolTipText(resourceMap.getString("jComboBox1.toolTipText")); // NOI18N
        jComboBox1.setName("jComboBox1"); // NOI18N

        jTextField7.setText(resourceMap.getString("jTextField7.text")); // NOI18N
        jTextField7.setMinimumSize(new java.awt.Dimension(100, 20));
        jTextField7.setName("jTextField7"); // NOI18N
        jTextField7.setPreferredSize(new java.awt.Dimension(200, 20));
        jTextField7.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField7KeyPressed(evt);
            }
        });

        javax.swing.GroupLayout panelFlowFilterAddressLayout = new javax.swing.GroupLayout(panelFlowFilterAddress);
        panelFlowFilterAddress.setLayout(panelFlowFilterAddressLayout);
        panelFlowFilterAddressLayout.setHorizontalGroup(
            panelFlowFilterAddressLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowFilterAddressLayout.createSequentialGroup()
                .addComponent(jToggleButton16)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(4, 4, 4)
                .addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE))
        );
        panelFlowFilterAddressLayout.setVerticalGroup(
            panelFlowFilterAddressLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowFilterAddressLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(jToggleButton16))
        );

        jPanel18.add(panelFlowFilterAddress);

        panelFlowFilterPrice.setName("panelFlowFilterPrice"); // NOI18N

        jTextField4.setText(resourceMap.getString("jTextField4.text")); // NOI18N
        jTextField4.setMinimumSize(new java.awt.Dimension(40, 20));
        jTextField4.setName("jTextField4"); // NOI18N
        jTextField4.setPreferredSize(new java.awt.Dimension(40, 20));
        jTextField4.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField4KeyPressed(evt);
            }
        });

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        jToggleButton14.setAction(actionMap.get("recs_refresh")); // NOI18N
        jToggleButton14.setText(resourceMap.getString("jToggleButton14.text")); // NOI18N
        jToggleButton14.setName("jToggleButton14"); // NOI18N

        jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
        jLabel7.setName("jLabel7"); // NOI18N

        jTextField6.setText(resourceMap.getString("jTextField6.text")); // NOI18N
        jTextField6.setMinimumSize(new java.awt.Dimension(40, 20));
        jTextField6.setName("jTextField6"); // NOI18N
        jTextField6.setPreferredSize(new java.awt.Dimension(40, 20));
        jTextField6.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField6KeyPressed(evt);
            }
        });

        jTextField3.setText(resourceMap.getString("jTextField3.text")); // NOI18N
        jTextField3.setMinimumSize(new java.awt.Dimension(40, 20));
        jTextField3.setName("jTextField3"); // NOI18N
        jTextField3.setPreferredSize(new java.awt.Dimension(40, 20));
        jTextField3.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField3KeyPressed(evt);
            }
        });

        jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        jSeparator13.setOrientation(javax.swing.SwingConstants.VERTICAL);
        jSeparator13.setName("jSeparator13"); // NOI18N
        jSeparator13.setPreferredSize(new java.awt.Dimension(5, 20));

        jToggleButton15.setAction(actionMap.get("recs_refresh")); // NOI18N
        jToggleButton15.setText(resourceMap.getString("jToggleButton15.text")); // NOI18N
        jToggleButton15.setName("jToggleButton15"); // NOI18N

        jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
        jLabel8.setName("jLabel8"); // NOI18N

        jTextField5.setText(resourceMap.getString("jTextField5.text")); // NOI18N
        jTextField5.setMinimumSize(new java.awt.Dimension(40, 20));
        jTextField5.setName("jTextField5"); // NOI18N
        jTextField5.setPreferredSize(new java.awt.Dimension(40, 20));
        jTextField5.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTextField5KeyPressed(evt);
            }
        });

        jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
        jLabel5.setName("jLabel5"); // NOI18N

        javax.swing.GroupLayout panelFlowFilterPriceLayout = new javax.swing.GroupLayout(panelFlowFilterPrice);
        panelFlowFilterPrice.setLayout(panelFlowFilterPriceLayout);
        panelFlowFilterPriceLayout.setHorizontalGroup(
            panelFlowFilterPriceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addComponent(jToggleButton14)
                .addGap(5, 5, 5)
                .addComponent(jLabel1)
                .addGap(5, 5, 5)
                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel4)
                .addGap(5, 5, 5)
                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel5)
                .addGap(5, 5, 5)
                .addComponent(jSeparator13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jToggleButton15)
                .addGap(5, 5, 5)
                .addComponent(jLabel8)
                .addGap(5, 5, 5)
                .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel6)
                .addGap(5, 5, 5)
                .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(5, 5, 5)
                .addComponent(jLabel7))
        );
        panelFlowFilterPriceLayout.setVerticalGroup(
            panelFlowFilterPriceLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jTextField5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel6))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel7))
            .addComponent(jToggleButton14)
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel1))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel4))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel5))
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jSeparator13, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addComponent(jToggleButton15)
            .addGroup(panelFlowFilterPriceLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jLabel8))
        );

        jPanel18.add(panelFlowFilterPrice);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, 289, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(jPanel18, javax.swing.GroupLayout.PREFERRED_SIZE, 118, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addComponent(jPanel17, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE)
        );

        jToolBar2.add(jPanel6);

        mainPanel.add(jToolBar2, java.awt.BorderLayout.PAGE_END);

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        jMenuItem1.setAction(actionMap.get("rec_new")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        fileMenu.add(jMenuItem1);

        jMenuItem2.setAction(actionMap.get("rec_edit")); // NOI18N
        jMenuItem2.setName("jMenuItem2"); // NOI18N
        fileMenu.add(jMenuItem2);

        jMenuItem3.setAction(actionMap.get("rec_del")); // NOI18N
        jMenuItem3.setName("jMenuItem3"); // NOI18N
        fileMenu.add(jMenuItem3);

        jSeparator2.setName("jSeparator2"); // NOI18N
        fileMenu.add(jSeparator2);

        jMenuItem22.setAction(actionMap.get("clear_favorites")); // NOI18N
        jMenuItem22.setName("jMenuItem22"); // NOI18N
        fileMenu.add(jMenuItem22);

        jMenuItem4.setAction(actionMap.get("rec_map")); // NOI18N
        jMenuItem4.setName("jMenuItem4"); // NOI18N
        fileMenu.add(jMenuItem4);

        jMenuItem5.setAction(actionMap.get("rec_email")); // NOI18N
        jMenuItem5.setName("jMenuItem5"); // NOI18N
        fileMenu.add(jMenuItem5);

        jMenuItem6.setAction(actionMap.get("rec_www")); // NOI18N
        jMenuItem6.setName("jMenuItem6"); // NOI18N
        fileMenu.add(jMenuItem6);

        jSeparator10.setName("jSeparator10"); // NOI18N
        fileMenu.add(jSeparator10);

        jMenuItem14.setAction(actionMap.get("pro_config")); // NOI18N
        jMenuItem14.setName("jMenuItem14"); // NOI18N
        fileMenu.add(jMenuItem14);

        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        jMenu1.setText(resourceMap.getString("jMenu1.text")); // NOI18N
        jMenu1.setName("jMenu1"); // NOI18N

        jRadioButtonMenuItem1.setAction(actionMap.get("base_agent")); // NOI18N
        buttonGroup1.add(jRadioButtonMenuItem1);
        jRadioButtonMenuItem1.setName("jRadioButtonMenuItem1"); // NOI18N
        jMenu1.add(jRadioButtonMenuItem1);

        jRadioButtonMenuItem2.setAction(actionMap.get("base_office")); // NOI18N
        buttonGroup1.add(jRadioButtonMenuItem2);
        jRadioButtonMenuItem2.setName("jRadioButtonMenuItem2"); // NOI18N
        jMenu1.add(jRadioButtonMenuItem2);

        jRadioButtonMenuItem3.setAction(actionMap.get("base_global")); // NOI18N
        buttonGroup1.add(jRadioButtonMenuItem3);
        jRadioButtonMenuItem3.setName("jRadioButtonMenuItem3"); // NOI18N
        jMenu1.add(jRadioButtonMenuItem3);

        jSeparator12.setName("jSeparator12"); // NOI18N
        jMenu1.add(jSeparator12);

        jCheckBoxMenuItem1.setAction(actionMap.get("base_trash")); // NOI18N
        jMenu1.add(jCheckBoxMenuItem1);

        jCheckBoxMenuItem4.setAction(actionMap.get("only_favorites")); // NOI18N
        jCheckBoxMenuItem4.setName("jCheckBoxMenuItem4"); // NOI18N
        jMenu1.add(jCheckBoxMenuItem4);

        jSeparator6.setName("jSeparator6"); // NOI18N
        jMenu1.add(jSeparator6);

        jMenuItem7.setAction(actionMap.get("company_office")); // NOI18N
        jMenuItem7.setName("jMenuItem7"); // NOI18N
        jMenu1.add(jMenuItem7);

        jMenuItem8.setAction(actionMap.get("company_agent")); // NOI18N
        jMenuItem8.setName("jMenuItem8"); // NOI18N
        jMenu1.add(jMenuItem8);

        menuBar.add(jMenu1);

        jMenu2.setText(resourceMap.getString("jMenu2.text")); // NOI18N
        jMenu2.setName("jMenu2"); // NOI18N

        jMenuItem10.setAction(actionMap.get("recs_print")); // NOI18N
        jMenuItem10.setName("jMenuItem10"); // NOI18N
        jMenu2.add(jMenuItem10);

        jSeparator7.setName("jSeparator7"); // NOI18N
        jMenu2.add(jSeparator7);

        jMenuItem11.setAction(actionMap.get("recs_export")); // NOI18N
        jMenuItem11.setName("jMenuItem11"); // NOI18N
        jMenu2.add(jMenuItem11);

        jMenuItem12.setAction(actionMap.get("recs_import")); // NOI18N
        jMenuItem12.setName("jMenuItem12"); // NOI18N
        jMenu2.add(jMenuItem12);

        jSeparator8.setName("jSeparator8"); // NOI18N
        jMenu2.add(jSeparator8);

        jMenuItem13.setAction(actionMap.get("recs_sync")); // NOI18N
        jMenuItem13.setName("jMenuItem13"); // NOI18N
        jMenu2.add(jMenuItem13);

        jMenuItem17.setAction(actionMap.get("table_refresh")); // NOI18N
        jMenuItem17.setName("jMenuItem17"); // NOI18N
        jMenu2.add(jMenuItem17);

        jMenu3.setText(resourceMap.getString("jMenu3.text")); // NOI18N
        jMenu3.setName("jMenu3"); // NOI18N

        jMenuItem16.setText(resourceMap.getString("jMenuItem16.text")); // NOI18N
        jMenuItem16.setName("jMenuItem16"); // NOI18N
        jMenu3.add(jMenuItem16);

        jMenuItem23.setText(resourceMap.getString("jMenuItem23.text")); // NOI18N
        jMenuItem23.setName("jMenuItem23"); // NOI18N
        jMenu3.add(jMenuItem23);

        jMenu2.add(jMenu3);

        menuBar.add(jMenu2);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        jMenuItem9.setAction(actionMap.get("check_update")); // NOI18N
        jMenuItem9.setToolTipText(resourceMap.getString("jMenuItem9.toolTipText")); // NOI18N
        jMenuItem9.setName("jMenuItem9"); // NOI18N
        helpMenu.add(jMenuItem9);

        jMenuItem15.setAction(actionMap.get("run_remote_help")); // NOI18N
        jMenuItem15.setToolTipText(resourceMap.getString("jMenuItem15.toolTipText")); // NOI18N
        jMenuItem15.setName("jMenuItem15"); // NOI18N
        helpMenu.add(jMenuItem15);

        jMenuItem24.setAction(actionMap.get("send_feedback")); // NOI18N
        jMenuItem24.setText(resourceMap.getString("jMenuItem24.text")); // NOI18N
        jMenuItem24.setToolTipText(resourceMap.getString("jMenuItem24.toolTipText")); // NOI18N
        jMenuItem24.setName("jMenuItem24"); // NOI18N
        helpMenu.add(jMenuItem24);

        jSeparator15.setName("jSeparator15"); // NOI18N
        helpMenu.add(jSeparator15);

        debugButton.setAction(actionMap.get("debug_console")); // NOI18N
        debugButton.setText(resourceMap.getString("debugButton.text")); // NOI18N
        debugButton.setName("debugButton"); // NOI18N
        helpMenu.add(debugButton);

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setText(resourceMap.getString("aboutMenuItem.text")); // NOI18N
        aboutMenuItem.setToolTipText(resourceMap.getString("aboutMenuItem.toolTipText")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        jMenu4.setAction(actionMap.get("find_event")); // NOI18N
        jMenu4.setText(resourceMap.getString("jMenu4.text")); // NOI18N
        jMenu4.setName("jMenu4"); // NOI18N

        jCheckBoxMenuItem3.setAction(actionMap.get("panel_util")); // NOI18N
        jCheckBoxMenuItem3.setSelected(true);
        jCheckBoxMenuItem3.setName("jCheckBoxMenuItem3"); // NOI18N
        jMenu4.add(jCheckBoxMenuItem3);

        jCheckBoxMenuItem2.setAction(actionMap.get("panel_info")); // NOI18N
        jCheckBoxMenuItem2.setSelected(true);
        jCheckBoxMenuItem2.setText(resourceMap.getString("jCheckBoxMenuItem2.text")); // NOI18N
        jCheckBoxMenuItem2.setName("jCheckBoxMenuItem2"); // NOI18N
        jMenu4.add(jCheckBoxMenuItem2);

        jMenuItem18.setAction(actionMap.get("panel_reset")); // NOI18N
        jMenuItem18.setText(resourceMap.getString("jMenuItem18.text")); // NOI18N
        jMenuItem18.setName("jMenuItem18"); // NOI18N
        jMenu4.add(jMenuItem18);

        jMenuItem19.setAction(actionMap.get("find_event")); // NOI18N
        jMenuItem19.setName("jMenuItem19"); // NOI18N
        jMenu4.add(jMenuItem19);

        jMenuItem20.setAction(actionMap.get("find_event_price")); // NOI18N
        jMenuItem20.setText(resourceMap.getString("jMenuItem20.text")); // NOI18N
        jMenuItem20.setName("jMenuItem20"); // NOI18N
        jMenu4.add(jMenuItem20);

        jMenuItem21.setAction(actionMap.get("find_event_area")); // NOI18N
        jMenuItem21.setText(resourceMap.getString("jMenuItem21.text")); // NOI18N
        jMenuItem21.setName("jMenuItem21"); // NOI18N
        jMenu4.add(jMenuItem21);

        jRadioButtonMenuItem5.setAction(actionMap.get("changeFullScreen")); // NOI18N
        jRadioButtonMenuItem5.setSelected(true);
        jRadioButtonMenuItem5.setName("jRadioButtonMenuItem5"); // NOI18N
        jMenu4.add(jRadioButtonMenuItem5);

        menuBar.add(jMenu4);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 780, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 610, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        jPopupMenu1.setName("jPopupMenu1"); // NOI18N

        jMenuClearFavorites.setAction(actionMap.get("clear_favorites")); // NOI18N
        jMenuClearFavorites.setText(resourceMap.getString("jMenuClearFavorites.text")); // NOI18N
        jMenuClearFavorites.setName("jMenuClearFavorites"); // NOI18N
        jPopupMenu1.add(jMenuClearFavorites);

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
        setToolBar(jToolBar1);
    }// </editor-fold>//GEN-END:initComponents

    private void jTabbedPane3StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane3StateChanged
        if (init) openCurrentTable();
    }//GEN-LAST:event_jTabbedPane3StateChanged

    private void jTabbedPane4StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane4StateChanged
        if (init) openCurrentTable();
    }//GEN-LAST:event_jTabbedPane4StateChanged

    private void jTabbedPane2StateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jTabbedPane2StateChanged
        if (init) openCurrentTable();
    }//GEN-LAST:event_jTabbedPane2StateChanged

    private void jToggleButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButton16ActionPerformed
        buildAddressFilter();
    }//GEN-LAST:event_jToggleButton16ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        rec_map();
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jTextField7KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField7KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            jToggleButton16.setSelected(!jToggleButton16.isSelected());
        }
        
        if (evt.getKeyCode() == KeyEvent.VK_ENTER || jToggleButton16.isSelected()) {
            buildAddressFilter();
            recs_refresh();
        }
        
        /*if (jToggleButton16.isSelected()) {
            recs_refresh();
        }*/
    }//GEN-LAST:event_jTextField7KeyPressed

    private void jTextField6KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField6KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            jToggleButton15.setSelected(!jToggleButton15.isSelected());
        }
        if (jToggleButton15.isSelected()) {
            recs_refresh();
        }
    }//GEN-LAST:event_jTextField6KeyPressed

    private void jTextField5KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField5KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            jToggleButton15.setSelected(!jToggleButton15.isSelected());
        }
        if (jToggleButton15.isSelected()) {
            recs_refresh();
        }
    }//GEN-LAST:event_jTextField5KeyPressed

    private void jTextField4KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField4KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            jToggleButton14.setSelected(!jToggleButton14.isSelected());
        }
        if (jToggleButton14.isSelected()) {
            recs_refresh();
        }
    }//GEN-LAST:event_jTextField4KeyPressed

    private void jTextField3KeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField3KeyPressed
        if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
            jToggleButton14.setSelected(!jToggleButton14.isSelected());
        }
        if (jToggleButton14.isSelected()) {
            recs_refresh();
        }
    }//GEN-LAST:event_jTextField3KeyPressed

    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddActionPerformed

        addImageToButton();     }//GEN-LAST:event_btnAddActionPerformed
    
    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = MulisApp.getApplication().getMainFrame();
            aboutBox = new MulisAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        MulisApp.getApplication().show(aboutBox);
    }
    
    @Action
    public void rec_new() {
        openCurrentForm();
    }

    @Action
    public void rec_edit() {
        editCurrentTable();
    }

    @Action
    public void rec_del() {
        this.setReady(false);
        fakeDeleteCurrentItem();
        refreshCurrentTable();
        this.setReady(true);
    }

    @Action
    public void base_agent() {
        toggle_base_agent.setSelected(true);
        actionMap.get("company_office").setEnabled(false);
        actionMap.get("company_agent").setEnabled(false);
        refreshCurrentTable(true);
    }

    @Action
    public void base_office() {
        toggle_base_office.setSelected(true);
        actionMap.get("company_office").setEnabled(false);
        actionMap.get("company_agent").setEnabled(true);
        refreshCurrentTable(true);
    }

    @Action
    public void base_global() {
        toggle_base_global.setSelected(true);
        actionMap.get("company_office").setEnabled(true);
        actionMap.get("company_agent").setEnabled(false);
    }

    @Action
    public void company_office() {
    }

    @Action
    public void company_agent() {
        
    }

    @Action
    public void rec_map() {
        Util.openUrlInExternalBorwser("http://"+GlobalConfig.GLOBAL_MULIS_HOST+"/maps.php?f=true&a="+UtilSec.base64Encode(jTextField1.getText().trim()));
    }

    @Action
    public void rec_email() {
    }

    @Action
    public void rec_www() {
        //String ida = getCurrentTable().getCurrentIDA();
        Util.openUrlInExternalBorwser(Lang.findWWWByIDA(getCurrentTable().getCurrentIDA()));
    }

    @Action
    public void recs_selectall() {
        new LoginFrame(getFrame(), true).setVisible(true);
    }

    @Action
    public void recs_print() {
        printSelected();
    }

    @Action
    public void recs_export() {
    }

    @Action
    public void recs_import() {
    }

    @Action
    public void recs_sync() {
        if (GlobalConfig.MASTER_INN_GLOBAL.isEmpty()) {
            JOptionPane.showMessageDialog(getFrame(), "Глобальный ID не задан","Предупреждение",JOptionPane.INFORMATION_MESSAGE);
            new ConfigDialog(getFrame(), true,4).setVisible(true);
        } else {
        new SyncFrame(getFrame(), true).setVisible(true);}
    }
    
    @Action 
    public void recs_refresh() {
        refreshCurrentTable();
    }
    
    @Action
    public void pro_config() {
        new ConfigDialog(getFrame(), true).setVisible(true);
    }
    
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnAdd;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.ButtonGroup buttonGroup3;
    private javax.swing.JMenuItem debugButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton10;
    private javax.swing.JButton jButton11;
    private javax.swing.JButton jButton13;
    private javax.swing.JButton jButton14;
    private javax.swing.JButton jButton15;
    private javax.swing.JButton jButton16;
    private javax.swing.JButton jButton17;
    private javax.swing.JButton jButton18;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JButton jButton9;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem2;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem3;
    private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem4;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenuItem jMenuClearFavorites;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem10;
    private javax.swing.JMenuItem jMenuItem11;
    private javax.swing.JMenuItem jMenuItem12;
    private javax.swing.JMenuItem jMenuItem13;
    private javax.swing.JMenuItem jMenuItem14;
    private javax.swing.JMenuItem jMenuItem15;
    private javax.swing.JMenuItem jMenuItem16;
    private javax.swing.JMenuItem jMenuItem17;
    private javax.swing.JMenuItem jMenuItem18;
    private javax.swing.JMenuItem jMenuItem19;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JMenuItem jMenuItem20;
    private javax.swing.JMenuItem jMenuItem21;
    private javax.swing.JMenuItem jMenuItem22;
    private javax.swing.JMenuItem jMenuItem23;
    private javax.swing.JMenuItem jMenuItem24;
    private javax.swing.JMenuItem jMenuItem3;
    private javax.swing.JMenuItem jMenuItem4;
    private javax.swing.JMenuItem jMenuItem5;
    private javax.swing.JMenuItem jMenuItem6;
    private javax.swing.JMenuItem jMenuItem7;
    private javax.swing.JMenuItem jMenuItem8;
    private javax.swing.JMenuItem jMenuItem9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JPopupMenu jPopupMenu1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem1;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem2;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem3;
    private javax.swing.JRadioButtonMenuItem jRadioButtonMenuItem5;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JPopupMenu.Separator jSeparator10;
    private javax.swing.JToolBar.Separator jSeparator11;
    private javax.swing.JPopupMenu.Separator jSeparator12;
    private javax.swing.JSeparator jSeparator13;
    private javax.swing.JPopupMenu.Separator jSeparator15;
    private javax.swing.JToolBar.Separator jSeparator16;
    private javax.swing.JPopupMenu.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JPopupMenu.Separator jSeparator6;
    private javax.swing.JPopupMenu.Separator jSeparator7;
    private javax.swing.JPopupMenu.Separator jSeparator8;
    private javax.swing.JToolBar.Separator jSeparator9;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTabbedPane jTabbedPane2;
    private javax.swing.JTabbedPane jTabbedPane3;
    private javax.swing.JTabbedPane jTabbedPane4;
    private javax.swing.JTextArea jTextArea1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextField2;
    private javax.swing.JTextField jTextField3;
    private javax.swing.JTextField jTextField4;
    private javax.swing.JTextField jTextField5;
    private javax.swing.JTextField jTextField6;
    private javax.swing.JTextField jTextField7;
    private javax.swing.JToggleButton jToggleButton1;
    private javax.swing.JToggleButton jToggleButton10;
    private javax.swing.JToggleButton jToggleButton11;
    private javax.swing.JToggleButton jToggleButton12;
    private javax.swing.JToggleButton jToggleButton13;
    private javax.swing.JToggleButton jToggleButton14;
    private javax.swing.JToggleButton jToggleButton15;
    private javax.swing.JToggleButton jToggleButton16;
    private javax.swing.JToggleButton jToggleButton2;
    private javax.swing.JToggleButton jToggleButton3;
    private javax.swing.JToggleButton jToggleButton4;
    private javax.swing.JToggleButton jToggleButton5;
    private javax.swing.JToggleButton jToggleButton6;
    private javax.swing.JToggleButton jToggleButton7;
    private javax.swing.JToggleButton jToggleButton8;
    private javax.swing.JToggleButton jToggleButton9;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JPanel mainPhotoPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JPanel panelFlowAddressMap;
    private javax.swing.JPanel panelFlowAddressPhone;
    private javax.swing.JPanel panelFlowFilterAddress;
    private javax.swing.JPanel panelFlowFilterPrice;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JToggleButton toggle_base_agent;
    private javax.swing.JToggleButton toggle_base_favorites;
    private javax.swing.JToggleButton toggle_base_global;
    private javax.swing.JToggleButton toggle_base_office;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;

    @Override
    public void testCore() {
        System.out.println("Click!");
    }
    
    @Override
    public void exit() {
        System.exit(1);
    }

    @Override
    public int getCurrentIntFrame() {
        return (jTabbedPane2.getSelectedIndex()+1)*10 + ( ((jTabbedPane2.getSelectedIndex()+1)*10==Util.F_SALE)?jTabbedPane3.getSelectedIndex():jTabbedPane4.getSelectedIndex() );
    }

    @Action
    public void base_trash() {
        base_trash_selected = !base_trash_selected;
        jCheckBoxMenuItem1.setSelected(base_trash_selected);
        jToggleButton6.setSelected(base_trash_selected);
        //base_agent();
        refreshCurrentTable(true);
        //refreshCurrentTable();
    }

    @Action
    public void check_update() {
        if (!checkUpdate(this.getFrame())) JOptionPane.showMessageDialog(this.getFrame(), "Обновлений нет", "Проверка обновлений" ,JOptionPane.INFORMATION_MESSAGE);
    }

    @Action
    public void run_remote_help() {
        Util.runTeamViwerDL();
    }

    @Action
    public void table_refresh() {
        refreshCurrentTable(true);
        //recs_refresh();
    }

    @Action
    public void panel_util() {
        jToolBar1.setVisible(!jToolBar1.isVisible());
        jCheckBoxMenuItem3.setSelected(jToolBar1.isVisible());
    }

    @Action
    public void panel_info() {
        jToolBar2.setVisible(!jToolBar2.isVisible());
        jCheckBoxMenuItem2.setSelected(jToolBar2.isVisible());
        //jToolBar2.setLocation(0, 0);
    }

    @Action
    public void panel_reset() {
        jPanel1.setVisible(true);        
        actionMap.get("panel_info").putValue("checked", "true");
        actionMap.get("panel_util").putValue("checked", "true");
    }

    @Action
    public void find_event() {
        jTextField7.requestFocusInWindow();
        jToggleButton16.setSelected(!jToggleButton16.isSelected());
        recs_refresh(); // TODO: а надо ли?
    }

    @Action
    public void find_event_price() {
        jTextField3.requestFocusInWindow();
        jToggleButton14.setSelected(!jToggleButton14.isSelected());
    }

    @Action
    public void find_event_area() {
        jTextField5.requestFocusInWindow();
        jToggleButton15.setSelected(!jToggleButton15.isSelected());
    }

    private void addImageToButton() {
        
    }


    @Override
    public void showBigPhoto(int selected) {
        if (photoViewer==null || !photoViewer.isVisible()) {
            photoViewer=new PhotoViewer(this, selected);
            photoViewer.setAlwaysOnTop(true);
            photoViewer.setVisible(true);
        } else {
            photoViewer.showBigPhoto(selected);
            //photoViewer.toFront(); //OR Always on top? hm...
        }
    }

    @Override
    public List<ImageIcon> getPreImages() {
        return imgPreGallery;
    }

    @Override
    public ImageIcon getFullImage(int num) {
        if (num>imgGallery.size()) num=0;
        if (num<0) num=0;
        return imgGallery.get(num);
    }

    @Override
    public List<ImageIcon> getOrigImages() {
        return imgOrigGallery;
    }

    @Override
    public void generateFullImages(int size) {
        Util.generateFullImages(size, imgOrigGallery, imgGallery);
    }

    @Action
    public void changeFullScreen() {
        isMaximized=!isMaximized;
        //menuBar.setVisible(!isMaximized);
        statusPanel.setVisible(!isMaximized);
        if (isMaximized) {
            changeToFull();
        } else {
            changeToDefault();
        }
        //Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
        //getFrame().setSize(dim.width, dim.height);
    }
    
    public void changeToFull() {
        //menuBar.setSize(new Dimension(menuBar.getWidth(), 1));
        getFrame().setExtendedState(Frame.MAXIMIZED_BOTH);
        getFrame().remove(jToolBar1);
        jToolBar1.setOrientation(JToolBar.VERTICAL);
        getFrame().add(jToolBar1,BorderLayout.WEST);
        //getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); 
        // TODO: Сделать ребилд нижней панели на больших экранах
        //Dimension re = new Dimension(jPanel18.getMinimumSize());
        //jPanel8.setMinimumSize(new Dimension(re.width*3, re.height/2));
        //jPanel8.setSize(jPanel18.getMinimumSize());
    }
    
    public void changeToDefault() {
        getFrame().setExtendedState(Frame.NORMAL);
        getFrame().remove(jToolBar1);
        jToolBar1.setOrientation(JToolBar.HORIZONTAL);
        getFrame().add(jToolBar1,BorderLayout.NORTH);
       
    }

    @Action
    public void only_favorites() {
        base_favorites_selected=!base_favorites_selected;
        if (GlobalConfig.selectedRows.isEmpty()) base_favorites_selected=false;
        jCheckBoxMenuItem4.setSelected(base_favorites_selected);
        toggle_base_favorites.setSelected(base_favorites_selected);
        refreshCurrentTable(true);
    }

    @Action
    public void clear_favorites() {
        GlobalConfig.selectedRows.clear();
        refreshCurrentTable(true);
    }

    @Action
    public void send_feedback() {
        Util.openUrlInExternalBorwser("http://mulis.ru/feedback");
    }
 
}